using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rotempco.Core.ORM.Objects;

namespace Rotempco.Core.CSV.Objects
{
    public class CSVParameterMapping
    {
        public int CSVColumnIndex { get; set; }
        public string PropertyName { get; set; }
        public Type Type { get; set; }

        public CSVParameterMapping(int csvColumnIndex, SymbolPair symbolPair)
        {
            CSVColumnIndex = csvColumnIndex;
            PropertyName = symbolPair.PropertyName;
            Type = symbolPair.PropertyType;
        }
    }

    public class CSVParameterMappingCallback<T> : CSVParameterMapping
    {
        public Action<T, string> SetParameter { get; set; }
        public Func<string, string> ParseCSVString { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="csvColumnIndex"></param>
        /// <param name="symbolPair"></param>
        /// <param name="setParameter">Object instance, csvColumn</param>
        public CSVParameterMappingCallback(int csvColumnIndex, SymbolPair symbolPair, Action<T, string> setParameter = null, Func<string, string> parseCSVString = null)
            : base(csvColumnIndex, symbolPair)
        {
            SetParameter = setParameter;
            ParseCSVString = parseCSVString;
        }
    }
}
